chore(predict): migrate to keyset paginated endpoints#30159
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
8b4bc37 to
40ab49d
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d094762. Configure here.
| queryParams, | ||
| limit: pageSize, | ||
| offset: typeof pageParam === 'number' ? pageParam : 0, | ||
| afterCursor: typeof pageParam === 'string' ? pageParam : null, |
There was a problem hiding this comment.
World Cup infinite scroll re-fetches first page repeatedly
High Severity
World Cup infinite scroll pagination is fully broken. getNextPageParam still returns a numeric offset (allPages.length * pageSize), but fetchInfiniteWorldCupMarketsPage now expects a string cursor (typeof pageParam === 'string' ? pageParam : null). Since the page param is a number, afterCursor is always null, so every subsequent page re-fetches the first page. Additionally, fetchPredictWorldCupMarkets discards the nextCursor from the getMarkets response, so no cursor is ever available to getNextPageParam.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit d094762. Configure here.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Tags selected:
Performance Test Selection: |
|





Description
Migrates the Predict market feed from Polymarket legacy offset-based list endpoints to the new keyset/cursor endpoints before deprecation.
This PR:
offsettoafterCursor/nextCursor./events/keyset./markets?condition_ids=...list helper usage.getMarketsintosearchMarkets, while keeping/public-searchunchanged.usePredictSearchMarketDatafor search overlay and Trending predictions search behavior.Changelog
CHANGELOG entry: null
Related issues
Fixes: PRED-881
Manual testing steps
Screenshots/Recordings
N/A — API/data pagination migration with no intended UI changes.
Before
N/A
After
N/A
Pre-merge author checklist
Performance checks (if applicable)
For performance guidelines and tooling, see the Performance Guide.
Testing performed
yarn generate-method-action-typesyarn lint:tscNODE_OPTIONS='--max-old-space-size=12288' yarn eslint <changed files>— no errors; existing deprecation warnings onlyCI=true NODE_OPTIONS=--max-old-space-size=8192 yarn jest app/components/UI/Predict/providers/polymarket/utils.test.ts app/components/UI/Predict/providers/polymarket/PolymarketProvider.test.ts app/components/UI/Predict/controllers/PredictController.test.ts app/components/UI/Predict/hooks/usePredictMarketData.test.tsx app/components/UI/Predict/hooks/usePredictSearchMarketData.test.tsx app/components/UI/Predict/views/PredictFeed/PredictFeed.test.tsx --runInBand --forceExitCI=true NODE_OPTIONS=--max-old-space-size=8192 yarn jest -c jest.config.view.js app/components/UI/Predict/views/PredictFeed/PredictFeed.view.test.tsx --runInBand --silent --coverage=false --forceExitrg "/events\\?|/events/pagination|/markets\\?" app/components/UI/Predict— no matchesPre-merge reviewer checklist
Note
Medium Risk
Medium risk due to widespread contract changes to
getMarkets(new{ markets, nextCursor }shape andafterCursorpagination) across controller/provider/hooks, plus new search path (searchMarkets) that affects Predict and Trending search UX and API calls.Overview
Updates Predict market fetching to use keyset/cursor pagination instead of offset pagination:
GetMarketsParamsswapsoffsetforafterCursor,getMarketsnow returnsGetMarketsResult({ markets, nextCursor }), and Polymarket requests move togamma-api/events/keysetwith parsing/typing updates.Splits search out of
getMarketsinto a newPredictController.searchMarkets/PredictProvider.searchMarketsflow backed by/public-search, and addsusePredictSearchMarketDatato drive the Predict feed search overlay and Trending predictions search; UI logic is adjusted to avoid showing “no results”/error states before a query is entered.World Cup and other consumers/tests/mocks are updated to the new cursor-based contract, including new keyset API mocks and react-query test wrappers/cleanup to prevent query cache leakage.
Reviewed by Cursor Bugbot for commit 3d97a82. Bugbot is set up for automated code reviews on this repo. Configure here.